var app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    parameter: {
      type: Object,
      value: {
        class: '0'
      },
    },
    logoUrl: {
      type: String,
      value: '',
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    navH: ""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    return: function() {
      wx.navigateBack();
    },
    setGoodsSearch: function() {
      wx.navigateTo({
        url: '/packageB/goods_search/index',
      })
    },
    setClass: function() {
      var color = '';
      switch (this.data.parameter.class) {
        case "0":
        case 'on':
          color = 'on'
          break;
        case '1':
        case 'black':
          color = 'black'
          break;
        case '2':
        case 'gray':
          color = 'gray'
          break;
        case '3':
        case "red":
          color = 'red'
          break;
        case '4':
        case "gradual01":
          color = 'gradual01'
          break;
        default:
          break;
      }
      this.setData({
        'parameter.class': color
      })
    }
  },
  /**
   * 组件生命周期函数-在组件实例进入页面节点树时执行)
   */
  attached: function() {
    this.setData({
      navH: app.globalData.navHeight
    });
  },
  /**
   * 组件生命周期函数-在组件布局完成后执行)
   */
  ready: function() {
    this.setClass();
    var pages = getCurrentPages();
    if (pages.length <= 1) this.setData({
      'parameter.return': 1
    });
  }
})